package com.foreknow.demo12;

/**
 * 重写
 */

public class Student extends Person {
    @Override
    public void showMessage() {
        System.out.println(this.getName()+"--"+this.getAge());
    }

    public static void main(String[] args) {
        Student student = new Student();
        student.setName("tom");
        student.setAge(80);
        student.showMessage();//调用的showMessage方法一定是子类重写之后的方法
    }
}